from typing import List, Optional, Any
from dataclasses import dataclass
from datetime import datetime


@dataclass
class QueryOnSaleCommodityListRequest:
    templateId: str
    minAbrade: str
    maxAbrade: str
    pageIndex: int = 1
    pageSize: int = 10
    gameId: str = "730"
    listType: str = "10"
    sortTypeKey: str = "SELL_PRICE_ASC"
    listSortType: int = 1
    sortType: int = 0


@dataclass
class Sticker:
    id: Optional[int] = None
    name: Optional[str] = None
    img: Optional[str] = None
    wear: Optional[float] = None
    slot: Optional[int] = None


@dataclass
class CommodityItem:
    id: int
    type: int
    gameId: int
    userId: int
    commodityNo: str
    commodityName: str
    templateId: int
    iconUrl: str
    iconUrlLarge: str
    price: str
    publishTime: int
    userNickName: str
    userAvatar: str
    mine: bool
    typeName: str
    commodityHashName: str
    abrade: str
    stickers: List[Sticker]
    actions: str
    paintSeed: int
    favorite: Optional[Any] = None
    openSublet: Optional[Any] = None
    newOrder: Optional[Any] = None
    openNewOrder: Optional[Any] = None
    oldUserId: Optional[Any] = None
    steamId: Optional[Any] = None
    steamAssetId: Optional[Any] = None
    steamClassId: Optional[Any] = None
    steamInstanceId: Optional[Any] = None
    steamOfferId: Optional[Any] = None
    selectId: Optional[Any] = None
    floorPrice: Optional[Any] = None
    markPrice: Optional[Any] = None
    markPricePercent: Optional[Any] = None
    number: Optional[Any] = None
    attach: Optional[Any] = None
    remark: str = ""
    reason: Optional[Any] = None
    retryNum: Optional[Any] = None
    attr: Optional[Any] = None
    status: Optional[Any] = None
    frozenTime: Optional[Any] = None
    successTime: Optional[Any] = None
    failTime: Optional[Any] = None
    offerTime: Optional[Any] = None
    onShelfTime: Optional[Any] = None
    offShelfTime: Optional[Any] = None
    updateTime: Optional[Any] = None
    images: Optional[Any] = None
    img3d: Optional[Any] = None
    stickerRefreshStatus: Optional[Any] = None
    haveSticker: int = 0
    haveBuZhang: int = 0
    haveNameTag: int = 0
    canSold: int = 1
    canLease: Optional[Any] = None
    weaponTypeName: Optional[Any] = None
    weaponTypeHashName: Optional[Any] = None
    weaponTypeIcon: Optional[Any] = None
    weaponTypeId: Optional[Any] = None
    leaseUnitPrice: str = "0"
    longLeaseUnitPrice: str = "0"
    ultraLongLeaseUnitPrice: Optional[Any] = None
    leaseDeposit: str = "0"
    openLongLease: Optional[Any] = None
    nameTags: Optional[Any] = None
    isCanSold: Optional[Any] = None
    rarityName: Optional[Any] = None
    rarityColor: Optional[Any] = None
    qualityName: Optional[Any] = None
    qualityColor: Optional[Any] = None
    exteriorName: Optional[Any] = None
    exteriorColor: Optional[Any] = None
    leaseMaxDays: int = 8
    leaseGiveConfigs: Optional[Any] = None
    dopplerStatus: int = 0
    dopplerName: Optional[Any] = None
    dopplerColor: Optional[Any] = None
    fadeStatus: int = 0
    fadeName: Optional[Any] = None
    fadeColor: Optional[Any] = None
    fadeNumber: Optional[Any] = None
    isHardened: int = 0
    hardenedName: Optional[Any] = None
    hardenedColor: Optional[Any] = None
    secondDFrontImage: Optional[str] = None
    transPic: Optional[str] = None
    storeName: str = ""
    zeroRentLeaseStr: Optional[Any] = None
    zeroRentLeasePrice: Optional[Any] = None
    zeroRentDepositStr: Optional[Any] = None
    ultraLongLeaseDays: Optional[Any] = None
    commodity_list_type: int = 0
    batchNumContent: Optional[Any] = None
    clothContent: Optional[Any] = None
    groupId: Optional[Any] = None
    mergeList: List[Any] = None
    tagList: List[Any] = None
    ultraRenterSubsidyPrice: Optional[Any] = None
    ultraRenterSubsidyPriceTips: Optional[Any] = None
    maxSubsidyPrice: Optional[Any] = None
    cashbackConfigs: List[Any] = None
    havePendant: int = 0
    pendants: List[Any] = None
    stickerPremiumInfo: Optional[Any] = None
    autoDeliveryType: Optional[Any] = None
    pendantStyle: Optional[Any] = None
    showCS22D: int = 1

    def __post_init__(self):
        # 确保列表字段不为None
        if self.stickers is None:
            self.stickers = []
        if self.mergeList is None:
            self.mergeList = []
        if self.tagList is None:
            self.tagList = []
        if self.cashbackConfigs is None:
            self.cashbackConfigs = []
        if self.pendants is None:
            self.pendants = []


@dataclass
class QueryOnSaleCommodityListResponse:
    Code: int
    Msg: str
    Data: List[CommodityItem]
    TotalCount: int
